package com.da.javatest.leetCode;

/**
 * @author chenlida
 * @date 2019/1/12 14:53
 * @description
 */
public class Code553 {
    public String optimalDivision(int[] nums) {
        if (nums.length == 1) {
            return nums[0] + "";
        }
        if (nums.length == 2) {
            return nums[0] + "/" + nums[1];
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < nums.length; i++) {
            if (i == 1) {sb.append("(");}
            sb.append(nums[i]);
            if (i != nums.length - 1) {
                sb.append("/");
            } else {
                sb.append(")");
            }

        }
        return sb.toString();
    }
}
